printf — Formatted Output


\begin{rail}
FormatPrint : 'printf' '(' String ( ( ',' Variable ) * ) ')' ;
\end{rail}
The printf function is intended for writing formatted output to standard output, which is usually the screen. It is similar to the C language function of the same name, though some features are limited or not available, since doesn't have all the data types of C. The first argument is the format string. It consists of the text to be written out, and possibly some conversion specifications. A conversion specification is a sequence of commands that determine how the remainder of the arguments are to be displayed. The left most conversion specifier is matched to the third argument, the next specifier to the fourth argument, and so on. Each argument has to be matched to a conversion specification. When the format string is being scanned, the argument that matches the the specifier that the scanner is up to is called the current argument . Conversion specifications always begin with a +